package com.remenote.remenoteback.context.config;

import com.remenote.remenoteback.context.interceptor.AuthorityInterceptor;
import com.remenote.remenoteback.context.interceptor.HttpRequestInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @BelongsProject: remenote-back
 * @BelongsPackage: com.remenote.remenoteback.context.config
 * @Author: 23392
 * @CreateTime: 2024-03-18  13:29
 * @Description: TODO
 * @Version: 1.0
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Autowired
    AuthorityInterceptor authorityInterceptor;
    @Autowired
    HttpRequestInterceptor httpRequestInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authorityInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/user/login","/user/register");
        registry.addInterceptor(httpRequestInterceptor)
                .addPathPatterns("/**");
    }
}
